home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / exeprc.c < prev    next >
C/C++ Source or Header  |  1991-07-05  |  1KB  |  48 lines

  1. /*****************************************************************************
  2.  
  3.     ExePrc()
  4.  
  5.     This function executes a % command.
  6.  
  7.     n%q    Add n to Q-register q and return result
  8. *****************************************************************************/
  9.  
  10. #include "zport.h"        /* define portability identifiers */
  11. #include "tecoc.h"        /* define general identifiers */
  12. #include "defext.h"        /* define external global variables */
  13. #include "deferr.h"        /* define identifiers for error messages */
  14.  
  15. DEFAULT ExePrc()        /* execute % (percent) command */
  16. {
  17.     DBGFEN(1,"ExePrc",NULL);
  18.  
  19.     if (EStTop == EStBot) {            /* if no numeric argument */
  20.         NArgmt = 1;            /* default is 1%q */
  21.     } else {
  22.         UMinus();            /* if it's -%, make it -1% */
  23.         if (GetNmA() == FAILURE) {    /* get numeric argument */
  24.             DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
  25.             return FAILURE;
  26.         }
  27.     }
  28.  
  29.     if (IncCBP() == FAILURE) {
  30.         DBGFEX(1,DbgFNm,"FAILURE, IncCBP() failed");
  31.         return FAILURE;
  32.     }
  33.  
  34.     if (FindQR() == FAILURE) {
  35.         DBGFEX(1,DbgFNm,"FAILURE, FindQR() failed");
  36.         return FAILURE;
  37.     }
  38.  
  39.     QR->Number += NArgmt;
  40.  
  41. #if DEBUGGING
  42.     sprintf(DbgSBf,"PushEx(%ld,OPERAND)",QR->Number);
  43.     DbgFEx(1,DbgFNm,DbgSBf);
  44. #endif
  45.  
  46.     return PushEx(QR->Number, OPERAND);
  47. }
  48.